<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title></title>
		<style type="text/css">
			
		</style>
	</head>

	<body>
		<div>
			<p>用户名：<input type="text" id="username" value="" /></p>
			<p>密码：<input type="text" id="password" value="" /></p>
			<p><input type="button" name="" id="" value="注册" onclick="register()" /></p>
		</div>

		<script src="js/jmessage-sdk-web-2.1.0.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/md5.js" type="text/javascript" charset="utf-8"></script>
	    <script src="js/init.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			window.JIM = new JMessage({
//				debug: true,
			});
			window.onload = function() {
				init();
			}
			
			//注册功能
			function register() {
				var Uname = document.getElementById("username").value
				var Pwd = document.getElementById("password").value
				JIM.register({
					'username': Uname,
					'password': Pwd,
					'is_md5': false
				}).onSuccess(function(data) {
					Uname = ""
					Pwd = ""
					console.log('success:' + JSON.stringify(data));
					location.href = "login.html"
				}).onFail(function(data) {
					console.log('error:' + JSON.stringify(data))
				});
			}
		</script>
	</body>

</html>